<style type='text/css'>

.content xtable {
	border: 1px solid black;
	}
	
.sections .h1 {
	padding-left: 0px;
	}
.sections .h2 {
	padding-left: 16px;
	}
.sections .h3 {
	padding-left: 32px;
	}
.sections .h4 {
	padding-left: 48px;
	}
	
.sections .h5 {
	padding-left: 64px;
	}
.sections .h6 {
	padding-left: 72px;
	}
	
.term {
	background: #000000;
	color: #ffffff;
	font-weight: bold;
	}
</style>
<?
global $_skin;
$page = $_skin["page"];
$link = $page["link"];

if (!$page["title"]) $page["title"] = $_skin["title"];

#var_dump($e);

echo "<table cellpadding=0 cellspacing=0 border=0>";

echo "<tr>";

echo "<td>";
echo "<h1>{$page["title"]}</h1>";

/*
if ($link!="") { 
echo "<td>";
echo "<form action='$topurl/wiki/edit.php'>";
echo "<input type='hidden' name='parent' value='$link'>";
echo "New Item: <input type='text' name='link' size=20>";
echo "<input type='submit' value='Go'>";
echo "</form>";
}
*/

echo "<td>";
echo "<form action='$topurl/wiki/search.php' method=get>Search: <input type='text' name='query' value=\"".htmlentities($_REQUEST["query"])."\"><input type='submit' value='Go'></form>";

echo "<td>";
echo "<form action='$topurl/wiki/map.php' method=get><input type='submit' value='Map'></form>";

echo "</table>";


echo "<table><tr><td valign=top>";

global $db;
$r = $db->query("select id,name,link from wiki where latest = 1 and parent is null order by name");
foreach ($r as $e) {
	echo "<a href='{$e["link"]}'>{$e["name"]}</a><br>";
	}

?>

<td valign=top>
<?
$link = $page["link"];
if ($link!="") {
inc_incfile("links.php",array(
	"actions"=>array(
		"view"=>"view.php?link=$link",
		"edit"=>"edit.php?link=$link",
		"meta"=>"meta.php?link=$link",
		"source"=>"source.php?link=$link",
		"history"=>"history.php?link=$link",
		"links"=>"links.php?link=$link",
		"comments"=>"comments.php?link=$link",
		),
	));
echo "<hr>";
}

?>
<?
if ($_skin["title"]) {
	echo "<h1>{$_skin["title"]}</h1>";
	}
?>

<?
global $_wiki_sections;
$r = $_wiki_sections;
if (is_array($r)) {
echo "<table class='sections' align=right>";
	foreach ($r as $e) {
	echo "<tr><td class='{$e["element"]}'><a href='#{$e["title"]}'>{$e["title"]}</a>";
	}
echo "</table>";
}
?>

%%
<? 
/*
if ($_skin["mode"] == "view") {
	echo "<hr>";
	$r = $db->query("select * from wiki where parent = ".$db->sqlstring($link)." and latest = 1 order by name");
	echo "<table>";
	foreach ($r as $e) {
		echo "<tr>";
		echo "<td valign=top><a href=\"{$e["link"]}\">".htmlentities($e["name"])."</a>";
		echo "<td valign=top>"._wiki_getsection($e["content"],"summary");
		}
	echo "</table>";
}
*/
?>


<? return; ?>

<?
global $_skin;
$e = $_skin["page"];
$id = $e["id"];
?>
<h1>Sample Skin</h1>
<?
#main nav
$r = $db->query("select * from page where parentid = 0 order by orders");
echo "<div>";
foreach ($r as $ce) {
	echo "<a href='../{$ce["id"]}/'>{$ce["name"]}</a> | ";
	}
echo "</div>";
?>


<?
#parents
$pr = array();
$pid = $e["parentid"];
while ($pid) {
	$pr[] = $pe = $db->query1("select * from page where id = ".$db->sqlint($pid));
	$pid = $pe["parentid"];
	}
/*
$pr[] = array(
	"id"=>0,
	"name"=>"Top",
	);
*/
$pr = array_reverse($pr);
echo "<div>";
foreach ($pr as $pe) {
	echo "<a href='../{$pe["id"]}/'>{$pe["name"]}</a> &gt; ";
	}
echo "</div>";
?>

<h1><?=$e["title"];?></h1>

<?
#children
$r = $db->query("select * from page where parentid = ".$db->sqlint($id)." order by orders");
echo "<p>";
foreach ($r as $ce) {
	echo "<a href='../{$ce["id"]}/'>{$ce["name"]}</a><br>";
	}
echo "</p>";

?>

<div class='content'>
%%
</div>
